import {toast} from "../../../utils/tool";

const app = getApp()
Component({
    properties: {
        record: {}
    },
    methods: {
        confirmHandle() {
            const {id, qr_code, taocan} = this.data.record
            if (!taocan || !taocan.length) return toast({title: '套餐信息错误'})
            this.triggerEvent('confirm',this.data.record)
            return
            const [targetMeal] = taocan
            app.ajax({
                url: '/api/user/yanquanOrder',
                method: 'POST',
                data: {
                    qr_code,
                    room_id: id,
                    taocan_id: targetMeal.id
                }
            })
        },
        previewHandle() {
            const {image} = this.data.record
            wx.previewImage({
                urls: [image],
            })
        }
    }
});
